<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<mat-card>
  <mat-card-content class="settings">
    <h3 class="settings__title">Settings</h3>
    <div class="settings__subtitle">Adjust the settings to match your needs.</div>

    <form *ngIf="form" [formGroup]="form">
      <gio-banner-info>
        <div>Logging smartly</div>
        <span gioBannerBody>Opt for logging checkboxes carefully, this requires extra storage and may affect API performance.</span>
      </gio-banner-info>

      <div class="settings__form-control">
        <div class="settings__form-control__title">Logging mode</div>
        <div class="settings__form-control__subtitle">Customize the mode included.</div>
        <mat-checkbox formControlName="entrypoint">Entrypoint</mat-checkbox>
        <mat-checkbox formControlName="endpoint">Endpoint</mat-checkbox>
      </div>

      <div class="settings__form-control">
        <div class="settings__form-control__title">Logging phase</div>
        <div class="settings__form-control__subtitle">Customize the phases included.</div>
        <mat-checkbox formControlName="request">Request</mat-checkbox>
        <mat-checkbox formControlName="response">Response</mat-checkbox>
      </div>

      <div class="settings__form-control">
        <div class="settings__form-control__title">Content data</div>
        <div class="settings__form-control__subtitle">Customize the data included.</div>
        <mat-checkbox formControlName="headers">Headers</mat-checkbox>
        <mat-checkbox formControlName="payload">Payload</mat-checkbox>
      </div>

      <div class="settings__form-control">
        <div class="settings__form-control__title">Display conditions</div>
        <div class="settings__form-control__subtitle">Filter the data that matter to you.</div>

        <mat-form-field>
          <mat-label>Request phase condition</mat-label>
          <input matInput formControlName="condition" />
          <mat-hint> Support EL (e.g: &#123; #request.headers['Content-Type'][0] === 'application/json' &#125;)</mat-hint>
        </mat-form-field>
      </div>

      <gio-save-bar
        *ngIf="form.dirty"
        [form]="form"
        [opened]="form.dirty"
        [formInitialValues]="defaultConfiguration"
        (resetClicked)="discard()"
        (submitted)="submit()"
      ></gio-save-bar>
    </form>
  </mat-card-content>
</mat-card>
